﻿#include<iostream>
#include<string>
using namespace std;
using std::string;
int main() {
	char str[0x10] = "123";
	char strB[0x10] = "123";

	char strC[0x20];
	memcpy(strC, str, strlen(str));
	memcpy(strC + strlen(str), strB, strlen(strB) + 1);

	cout << strC << endl;//123123

	string str1{ "0123456",2,3 };//2为截取起始位置（从0开始），3为截取的长度
	string str2(2, 65);//2为复制个数，65为字符的ASCII码
	string str3(2, 'A');//也可以这么写
	//cin >> str1;
	cout << str1 << endl;
	cout << str2 << endl;
	cout << str3 << endl;

	string Str, ls;
	ls = "123";
	Str = ls + " " + "456";//开头一定要string的变量才不会报错
	cout << Str << endl;//123 456

	string str4;
	str4 = 56;
	cout << str4 << endl;//8，直接等于数字就会转化为ASCII码

	string str5 = ls + to_string(123);
	cout << str5 << endl;//123123
}